package com.hins.demo.web;

import com.hins.component.dto.Response;
import com.hins.demo.api.TransferServiceI;

import com.hins.demo.dto.TransferUpdateCmd;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * Description: 转账
 *
 * @author wenjiaqi
 * @date 2021/5/14 15:05
 */
@RestController
@RequestMapping("/transfer")
public class TransferController {

    @Autowired
    private TransferServiceI transferService;

    @PostMapping("/transfer")
    public Response transfer(@Valid TransferUpdateCmd transferUpdateCmd) {
        // token
        Integer userId = 666;
        transferUpdateCmd.getTransferDTO().setSourceUserId(userId);
        return transferService.transfer(transferUpdateCmd);
    }
}
